#ifndef PIDWIDGET_H
#define PIDWIDGET_H

#include <QDockWidget>

class QCheckBox;
class QComboBox;
class QLineEdit;

#include "registerdef.h"

class PIDwidget : public QDockWidget
{
    Q_OBJECT

public:
    PIDwidget(QWidget *parent=0);

public slots:
    void setRegisterList(QList<RegisterDef> *regList);
    void loadPIDinfo();
    void updatePIDinfo();
    void on_pidChannel_currentIndexChanged(int index);
    void pidRegisterUpdated(RegisterDef reg);
    void on_pidEnabled_stateChanged(int state);
    void on_pidSrc_activated(int index);
    void on_pidDest_activated(int index);
    void on_pidRef_editingFinished();
    void on_pidMax_editingFinished();
    void on_pidMin_editingFinished();
    void on_pidPgain_editingFinished();
    void on_pidIgain_editingFinished();
    void on_pidDgain_editingFinished();
    void on_pidKterm_editingFinished();
    void on_pidInterval_editingFinished();

signals:
    void writeNeeded(int address, QString value);
    void readNeeded(int address);

private:
    QList<RegisterDef> *m_reglist;
    QStringList pidSrcs;
    QStringList pidDests;
    QStringList pidRegNames;

    QCheckBox *ui_pidEnabled;
    QComboBox *ui_pidChannel;
    QComboBox *ui_pidSrc;
    QComboBox *ui_pidDest;
    QLineEdit *ui_pidRef;
    QLineEdit *ui_pidMax;
    QLineEdit *ui_pidMin;
    QLineEdit *ui_pidPgain;
    QLineEdit *ui_pidIgain;
    QLineEdit *ui_pidDgain;
    QLineEdit *ui_pidKterm;
    QLineEdit *ui_pidInterval;
};

#endif // PIDWIDGET_H
